orderlistCtrl.$inject = [
    '$scope',
    '$location',
    'orderService'
]

function orderlistCtrl($scope, $location, orderSvc) {
    var vm=this;
    vm.olist=[];
    vm.client = JSON.parse(sessionStorage.client);
    console.log('client olist......');
    console.log(vm.client);
    
    orderSvc.findOrderByClient(vm.client._id, function(error, olist) {
                vm.olist=olist;
            })

    vm.loadorder = function (state) {
        vm.activeTab = state;
        if(state=='6') {
            orderSvc.findOrderByClient(vm.client._id, function(error, olist) {
                vm.olist=olist;
            })
        }
        else{

            orderSvc.findOrderByOstateandClient(vm.client._id, state, function(error, olist) {
                vm.olist=olist;
            });
        }
    }

    vm.detail = function (oid) {
            $location.path('/orderdetail/'+oid);
    }

}

module.exports = orderlistCtrl;